<?php
namespace app\admin\model;

use think\Model;
use think\facade\Db;

class Category extends Model
{
    public $listFilterFields = ['desc', 'create_time', 'update_time'];
    public $searchFields = ['title'];

    public function special($param = [], $save = [])
    {
        if($param['pid']??false){
            $parent = Db::name('category')->where('id', $param['pid'])->field('site_id, language_id')->find();
            $save['site_id'] = $parent['site_id'];
            $save['language_id'] = $parent['language_id'];
        }
        return $save;
    }
}